package logic

import (
	"context"
	"doc-manage/models/mysql"

	"doc-manage/doc/doc"
	"doc-manage/doc/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type DocListLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewDocListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DocListLogic {
	return &DocListLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 列表
func (l *DocListLogic) DocList(in *doc.DocListRequest) (*doc.DocListResponse, error) {
	// todo: add your logic here and delete this line

	var Doc mysql.Doc
	var lists []*doc.DocList
	lists, err := Doc.DocList(mysql.DB, lists)
	if err != nil {
		return nil, err
	}

	return &doc.DocListResponse{
		List: lists,
	}, nil
}
